Method for Labeling Segments of Paths as Interior or Exterior

ABSTRACT

A method for labeling a segment of a two-dimensional input path defined according to a nonzero winding rule as either interior or exterior is described. A winding number is initialized. A scan line that intersects the segment is identified. For each contour of the input path, winding values are accumulated into the winding number for any segments of the contour that cross the identified scan line, where the accumulation for coincident segments that cross the identified scan line at a same location as the segment is postponed. These coincident segments are marked and saved in a list. The labeling of the segment as either interior or exterior is determined from the list and the winding number.

FIELD OF THE INVENTION

This invention relates generally to computer graphics, and moreparticularly to labeling segments of paths as interior or exterior.

BACKGROUND OF THE INVENTION

Paths, Contours, and Glyphs

In the field of computer graphics, two-dimensional paths are often usedto represent shapes of graphical objects that require rendering to aphysical device. Examples of such objects include glyphs, structuredvector graphics, illustrations, corporate logos, maps, and the like.Although we focus here on digital type, possibly the most common andimportant two-dimensional object, the following description applies toall types of two-dimensional objects. A collection of glyphs with aconsistent design is called a font. Fonts are ubiquitous in computerapplications. Fonts can be rendered on many types of physical devicessuch as computer monitors, telephones, printers, cameras, personaldigital assistants (PDAs), global positioning devices, televisions, andthe like.

A glyph is described by a path. Formally, a path includes a set ofcontours and a fill rule. A contour is a bounded and closed regionrepresented as a sequence of piece wise continuous directed segments.Segments can be linear or curved. Fill rules include a nonzero windingrule and an even-odd parity rule.

The even odd parity rule determines the “insideness” of a point for ashape defined by a path by drawing a ray from that point to infinity inany direction and counting the number of path segments from the shapethat the ray crosses. If this number is odd, then the point is inside;if even, the point is outside.

The non-zero winding rule is more complex. For a given path C and agiven point construct a ray, i.e., a straight line, heading out from Pin any direction towards infinity. Find all the intersections of C withthis ray. Score up the winding number as follows: for every clockwiseintersection, i.e., the path passing through the ray from left to right,as viewed from P, subtract 1; for every counter-clockwise intersection,i.e., path passing from right to left, as viewed from P, add 1. If thetotal winding number is zero, then P is outside C; otherwise, P isinside C.

Glyphs for computer applications are most frequently designed accordingto the nonzero winding rule. Glyphs can be filled with, e.g., a solidcolor, or their paths can be outlined, without filling interiorportions, to achieve various visual effects.

Nonzero Winding Rule

There are several problems when rendering paths that are to be filled oroutlined according to the nonzero winding rule. First, many renderingsystems do not support the nonzero winding rule because of itscomplexity, whereas almost all rendering systems support the even-oddparity rule. Second, the nonzero winding rule is slower to execute thanthe even-odd parity rule. This can be a problem when rendering, onresource constrained devices.

Third, as shown in FIGS. 6A, 6B, and 6C for partial glyphs, the nonzerowinding rule can produce “interior edge haloes” 601-603 for renderingsystems that operate in a certain way. The halo artifacts occur becausethe rendering first fills the shape, and then unconditionallyantialiases all the edges, which spoils the filling.

Other interior artifacts are shown in FIGS. 6D and 6E. FIG. 6D shows apath 611 with two (directed) contours that would be outlined correctlyin the prior art as the letter Q 612. However, if the path 621 isdefined by three contours or natural “strokes” as shown in FIG. 6E, thenthe interior (non-boundary) edges are not removed during the rendering,and the outline 622 is incorrect.

Other problems exist when using the nonzero winding rule, even forrendering systems that support the rule. Paths can often containself-intersections, coincident segments, and other degenerate cases thatrendering systems improperly handle because the systems incorrectlyfills or outlines the path.

Therefore, it is desirable to convert a path defined by the nonzerowinding rule to an equivalent path that can be rendered with either theeven-odd parity rule or the nonzero winding rule. It would be ideal ifthe equivalent path was simpler, smaller, faster to render, and did notexhibit any incorrect regions or annoying rendering artifacts due todegenerate cases such as those described above.

Furthermore, it is desirable to enable the correct and accuratedetermination of a segment of a path as either interior or exterior,even when the path contains self-intersections, coincident segments, andother degenerate cases. The correct and accurate determination for thesegment permits path rendering systems, path compression systems, pathsimplification systems, and the like to function correctly when the pathcontains degenerate cases.

U.S. Pat. No. 6,111,587 describes a method that converts a polygondefined by a nonzero winding rule to a polygon defined by an even-oddparity rule. That method operates on closed polygons with linear edges,where each polygon includes a set of labeled contours. The method doesnot correctly handle degenerate cases such as coincident segments,coincident points, and self-intersections in all of their variations.That method cannot render a simplified polygon defined by the nonzerowinding rule as output.

U.S. Pat. No. 7,321,373 describes a method for performing set operationson two or more arbitrary paths to produce a simple outline path. LikeU.S. Pat. No. 6,111,587, that method does not handle all degeneratecases correctly.

SUMMARY OF THE INVENTION

A method for labeling a segment of a two-dimensional input path definedaccording to a nonzero winding rule as either interior or exterior isdescribed. A winding number is initialized. A scan line that intersectsthe segment is identified. For each contour of the input path, windingvalues are accumulated into the winding number for any segments of thecontour that cross the identified scan line, where the accumulation forcoincident segments that cross the identified scan line at a samelocation as the segment is postponed. These coincident segments aremarked and saved in a list. The labeling of the segment as eitherinterior or exterior is determined from the list and the winding number.

Differences with the Prior Art

In general, prior art methods operate on closed polygons with linearedges where each polygon includes a set of known labeled contours. Theembodiments operate on a more general representation of shape, i.e.,open and closed paths with nonlinear edges and no predetermined labelingof which contours belong to which shapes.

Prior art methods convert paths filled by the nonzero winding rule topaths filled by the even-odd parity rule. The embodiments convert topaths that can be filled with either the even-odd parity rule or thenonzero winding rule. The output paths in the embodiments often requireless geometry than the input paths and therefore are more efficient torender and to store.

Prior art methods do not correctly handle coincident edges andcoincident points in all cases, e.g., those methods use different stepsto determine “outside edges,” and do not properly determine “outsideedges” in all cases. There, contours “switch” differently due to how the“outside edges” are determined. Also, prior art methods do not alwayscorrectly handle degenerate segments, nor do they perform iterativeintersection testing in the manner described in the embodiments oncontours until convergence to properly handle arithmetic round offerrors on underlying integer grid coordinates.

The prior art methods fail to handle all degenerate cases correctly, anddo not convert input nonzero winding rule paths to equivalent outputpaths that are simpler with less geometry as the paths used by theinvention. To facilitate this simplification, the embodiments performvarious steps to remove unmarked interior contours, degenerate segments,and degenerate contours.

BRIEF DESCRIPTION OF THE DRAWING

FIG. 1 is a schematic of example contours and paths used by embodimentsof the invention including input and output paths;

FIG. 2 is a flow diagram of a method for converting a two-dimensionalinput path defined b a nonzero winding rule to an equivalent 2D outputpath;

FIG. 3 is a flow diagram of a procedure for labeling segments accordingto embodiments of the invention;

FIG. 4 is a schematic of the method of FIG. 2;

FIG. 5 is a schematic of pairs of input and output paths according toembodiments of the invention;

FIGS. 6A, 6B, 6C, 6D and 6E are schematics of prior art renderings ofglyphs;

FIG. 7 is a flow diagram of a walking procedure according to embodimentsof the invention; and

FIG. 8 is a schematic of a procedure for labeling coincident edgesaccording to embodiments of the invention.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

Some embodiments of the invention provide a method for converting atwo-dimensional input path defined according to a nonzero winding ruleto an equivalent 2D output path that can be rendered by either thenonzero winding rule or an even-odd parity rule. The embodimentscorrectly label a segment of a path as interior or exterior. Theembodiments can produce renderings without aliasing or outliningartifacts. The embodiments are described using the followingdefinitions.

Definitions

As shown in FIG. 1, an input path 201 includes a set of contours101-102. Contours are represented as a sequence of piecewise continuousdirected segments. A degenerate contour is an unbounded or open region104, or a region with a zero area or a contour defined by a single point103.

A segment is defined using two or more points with (x, y) coordinatesdefined on an integer grid. The points include a start point 104 and anend point 105. Optionally, there can also be one or more control points106. For simplicity, this description is limited to linear and Beziersegments defined by two or three points, the extension to any number ofpoints and other curved segments, such as B-splines, will be obvious tothose skilled in the art. The segment emanates from the start point andterminates at the end point. The quadratic Bezier segment also includesan off-segment control point. The segment is exterior when it is aportion of a contour that defines a filled region according to thenonzero winding rule. Otherwise, the segment is interior.

Degenerate segments are transformed during processing to producenon-degenerate segments. Some examples follow. A segment start pointcannot be coincident, to its endpoint. Such segments are discarded. Thestart point and end point of a quadratic Bezier curve segment B(t),where t ranges from 0 to 1 inclusively, cannot lie on an “interior”portion of the curve segment, i.e., a portion of the curve segment witha parametric time t such that 0<t<1. Such segments are replaced with aline segment. The off-curve control point of a quadratic Bezier curvesegment cannot be coincident with either the start point or end point ofthat quadratic Bezier curve segment. Such segments are replaced with ahue segment.

Segments of each contour of the path are partitioned into multiplesegments to enforce that every segment is monotonic in both the x and ydirections. A segment can be partitioned into two segments by insertinga control point on the segment interior. A quadratic Bezier segment ispartitioned by inserting control points according to, e.g., a DeCasteljau algorithm. This significantly improves performance whendetermining self-intersecting contours. It also makes the labeling of asegment as interior or exterior simple and accurate.

Segments are approximated using linear subdivisions. A line segment istrivially approximated using a single linear subdivision. A quadraticBezier segment is approximated using one or more linear subdivisions.The control points of the linear subdivisions used to represent thequadratic Bezier segment are rounded to integer locations on the grid. Atarget rendering size is used to limit the number of linear subdivisionsrequired to represent a quadratic Bezier segment, thereby improving theperformance of computing intersections. Linear subdivisions aredetermined, on an as-needed basis and then saved for future processing.The start and end points of a linear subdivision cannot be coincident;such subdivisions are removed.

A junction contains data associated with a specific intersection. Thejunction specifies the Cartesian location of the intersection andmaintains a list of exterior segments emanating from that intersection,i.e., a list of outbound exterior segments.

Convert Paths Defined by the Nonzero Winding Rule

As shown in FIG. 2, some embodiments of the invention provide a methodfor converting the input path 201 defined by the nonzero winding rule tothe equivalent output path 202 that can be rendered by either thenonzero winding rule or the even-odd parity rule. The paths are definedin a two-dimensional (2D) coordinate system. The steps are schematicallyshown in FIG. 4.

Quantize and Transform

First, the method optionally converts, i.e., quantizes and transforms,205 non-integer control points of the input path to integers, ifnecessary. For example, TrueType® fonts are defined on an integercoordinate system of sufficient precision called the EM square andtherefore do not require quantization or transformation. When conversionis necessary, control points of the input path specified in floatingpoint or fixed point are transformed, e.g., multiplied by 256, and thenrounded to determine integers of sufficient precision.

When this step is skipped, the control points of the input path remainin their original coordinate system. The original coordinate system canbe defined on a floating, point or a fixed point grid, to name just afew. Arithmetic operations can be performed with a greater precision byskipping the quantizing and transforming, although this may increaseprocessing time and produce flaws in the output path 202.

Replace or Remove Degenerate Segments and Optionally EnforceMonotonicity

Then, after integer conversion, degenerate segments are removed 210.Some examples of degenerate segments follow. A segment start pointcannot be coincident to its endpoint. Such segments are discarded. Thestart point, and end point of a quadratic Bezier curve segment B(t),where t ranges from 0 to 1 inclusively, cannot lie on an “interior”portion of the curve segment, i.e., a portion of the curve segment witha parametric time t such that 0<t<1. Such segments are replaced with aline segment. The off-curve control point of a quadratic Bezier curvesegment cannot be coincident with either the start point or end point ofthat quadratic Bezier curve segment. Such segments are replaced with aline segment.

Optionally, monotonicity of the segments in both the x and y directionsare enforced 215.

Remove Degenerate Contours

Degenerate contours are removed 220. Some examples of degeneratecontours include a contour comprised of a single point, an open contour,i.e., a contour which is not “watertight,” and a contour with nointerior area.

Construct Data Structures for Accelerating Performance

Data structures for improving the run-time performance of the method areoptionally constructed 225. The data structures can also be constructedon demand and only when necessary during steps 230 and 240. Example datastructures include bounding boxes, proximity cluster trees, and gridsfor segments and contours.

Determine Intersections

Self-intersecting contours are determined 230. Self-intersectingcontours are partitioned and split at each point P of self-intersectionby inserting new control points at P into the sequence of continuoussegments preceding and following P. If the optional quantization andtransformation step was performed, then intersections are determined atinteger coordinates of the grid. Bezier segments are partitioned intolinear subdivisions as needed when it is possible the segments couldcontribute to an intersection. Intersection testing is performed on thelinear subdivisions to improve performance and accuracy. Themonotonicity of the segments and the acceleration data structures areused to minimize segment-segment intersection tests. Mark 235 eachcontour of the input path containing a self-intersection. This isfollowed by determining 240 contour-contour intersections, which arealso marked 245. For the purpose of this description, contours that arenot explicitly marked in some way are considered “unmarked.”

Following are additional rules and conventions when determiningintersections. To avoid redundant intersections, intersections thatoccur at t=0 are not counted, but intersections that occur at t=1 arecounted. Two coincident, line segments have at most two intersections. Asequence of line segments connected in a contour at a common endpointdoes not intersect at that common endpoint. After intersecting contourshave been processed, any linear subdivisions generated are no longerused. The intersections are inserted into the contours, e.g., Beziersegments are partitioned and split at their intersections, and thecontours of the path are walked as described below.

The contour intersection steps are repeated until no furtherintersections occur. This repetition is performed because newintersections can occur as a result al previously determinedintersections. This step ensures that the output path 202 is correct andthat subsequent rendering and processing is without any artifacts. Notethat most input paths require only a single iteration.

Remove Unmarked Interior Contours

Unmarked interior contours attic input path 201 are removed 250.Determine the winding number of any segment, e.g., we typically use thefirst segment of each unmarked contour of the input path 201 todetermine whether the segment is an interior contour and needs to beremoved prior to the walking step. Contours of the input path 201initially hidden may be revealed after the walking step and thereforeare removed now.

Linking and Generating Junctions

Then, intersections are linked 255 by generating a junction associatedwith the Cartesian location of each intersection. A junction containsdata about a specific intersection and specifies the Cartesian locationof the intersection and maintains a list of segments starting at thatlocation. For each unique intersection, i.e., each intersection withunique (x, y) coordinates, a list L of exterior outbound segments isdetermined. For each inbound segment to the intersection, a pointer to Lis maintained. An exterior outbound segment is a segment starting at anintersection, emanating outward from the intersection, and whose windingnumber indicates it is an exterior edge of the input path 201. Theproper labeling of outbound segments as exterior is an important step.After linking 255, the segments of L are properly labeled.

Walking

After the intersections are linked 255, each marked contour of the pathcan be walked 260 to generate new contours by merging. The walking canstart at any junction on a marked contour. Segments of marked contoursare either copied to the new contours or removed when the segments areinterior. The detailed steps of the walking process, as shown in FIG. 7,are as follows:

-   1. For each intersection point IP, i.e., for each junction, of the    marked contours perform these steps:-   2. Set 710 L to the list of exterior outbound segments of IP.-   3. If 715 L is empty, then goto step 1 and proceed to the next    intersection point.-   4. If 720 L is not empty, then get and remove the starting    segment L. Set S to this segment.-   5. Generate 730 a new contour C.-   6. Append 740 segment S to the end of C.-   7. If 750 the end point of S is IP, then we have traversed back to    IP. Goto step 3.-   8. If 750 the end point of S is not another intersection point, then    get the next segment, set this segment to S, and proceed to step 6.-   9. If 750 the end point of S is another intersection point Q other    than IP, then switch contours as follows: get the junction J of Q,    get and remove an exterior outbound segment of J, set this exterior    outbound segment to S, and proceed to step 6.

Remove Marked Contours

Next, marked contours of the input path 201 are removed 265. Segments ofmarked contours that contribute to the output path 202 have been copiedinto the new contours in the previous walking step.

Degenerate Contours are Removed

Next, degenerate contours of the remaining contours are removed 268.Examples of degenerate contours include a contour with a single point,an open contour, and a contour with no interior area.

Forming the Output. Path

Finally, the new contours and unmarked contours are collected 270 as theoutput path 202. The simplified output path can be rendered by eitherthe nonzero winding rule or the even-odd parity rule.

Invert Quantization and Transformation

If the input path 201 was optionally quantized and transformed in step205, then that process is inverted 275 on the output path 202 to restorethe coordinates to their original coordinate system.

Effects of the Conversion

FIG. 5 shows example pairs of paths 501-506, with the input paths 201 onthe left, and the output paths 202 on the right. The examples show thatthe output paths 202 will be correctly rendered with either the nonzerowinding rule or the even odd parity rule. Note the presence ofdegenerate cases, such as coincident segments in the input paths 201,and their proper handling to produce the correct output paths 202.

The merge contours procedure is object-based. The procedure explicitlydetermines the 2D output path 202 for further processing. Prior artimage-based approaches perform this operation during rasterization sothat only the pixels exhibit the result, and an explicit 2D outputdimensional path is not formed as described herein.

The input to the merge contours procedure is a single directed 2D path,such as a path representing a glyph. The interior of the path is definedby the nonzero winding rule. The output is an equivalent and simplified2D path that can be rendered by either the nonzero winding rule or theeven-odd parity rule. The simplification can include removal ofoverlapping, self-intersecting, degenerate, and unnecessary contours.

Path Conversion: An Example

FIG. 4 shows the operation of the method for converting an input path201 schematically. The input path 201 includes an exterior contour 401,an interior contour 402, and two intersecting contours 403-404. Thecontour 403 is also self-intersecting 411. The contours 403-404 have twocontour-contour intersections 412. The contours 403-404 withintersections are marked (M). The unmarked interior contour 402 isremoved. Next, junctions are associated with the intersections. Outboundsegments 420 at each junction are interior or exterior. The exterioroutbound segments at each junction are labeled and indicated by “∥”.

During the walking, a new contour 430 is generated by merging contourswhile marked and degenerate contours are removed.

The steps of the above method, as well as any other procedures ormethods described herein, can be performed m a processor connected to amemory and input/output interfaces and devices as known in the art.

Rendering: Filling or Outlining Paths Without Artifacts

The output path 202 as generated above can be rendered 280 by filling oroutlining with either the nonzero winding rule or the even-odd parityrule. Antialiasing 285 can also be applied. In contrast with the priorart, the filled path does not include an interior aliasing artifacts.Similarly, the outlined path does not include any interior edgeartifacts.

Interior and Exterior Segment Labeling

FIG. 3 shows a procedure to determine whether a segment S is interior orexterior. First, a winding number W is initialized 305 to zero. Next, ascan line that is guaranteed to intersect the segment is identified 310.If monotonicity is enforced for segments in both x and y directions,then the scan line can be quickly and accurately identified to be eithera horizontal or vertical scan line passing through the midpoint of thesegment.

For each contour C, the winding values are accumulated 315 into W forany segments of the contour C that cross the identified scan line beforecrossing the segment S. The accumulation of winding values into W forcoincident segments of the contour C that cross the scan line at thesame location as segment S is postponed until after all contours havebeen processed. The coincident segments have to be treated as a group,as far as the winding number is concerned, because they overlap andcancel each other. The coincident segments are marked and saved 320 in alist L; also see FIG. 8 for coincident segments.

When there are no coincident segments, we proceed as follows. If 345 Wis nonzero and W, when updated to account for S, is nonzero, then thesegment S is marked 350 interior, otherwise the segment S is markedexterior.

When there are coincident segments, we proceed as follows. Add 335segment S to the list L of saved coincident segments. Pairs ofcoincident segments in the list L that have opposite directions canceleach other out, and the accumulation of their winding numbers is zeroand does not change W. The winding values are accumulated 340 into W forthe remaining non-cancelled segments in the list L, excluding segment S.If 345 W is nonzero and W, when updated to account for S, is nonzero,then the segment S is marked 350 interior, otherwise the segment S ismarked exterior.

It is noted that prior art methods do not process coincident segments asdescribed above, and therefore can produce incorrect output paths withinterior artifacts.

FIG. 8 schematically shows the labeling of outbound segments of contours801-802 of the input path 201 so that the output path 202 is correct.The contours have coincident segments 803. The exterior outboundsegments are indicated by “∥”. Because of the nature of the stepsoutlined above, the segments 803 are correctly identified as interior,and hence these segments are removed during the walk. To the best of ourknowledge no prior art rendering deals with this case correctly in allof its variations. In this case, the coincident segments need to betreated as a group when the winding number is determined.

Applications and Distinguishing Features

Rendering methods that fill paths according to the even-odd parity rulecan use the merge contours procedure as outlined in FIG. 2 as apreprocessing step to correctly render paths that are designed to befilled according to the nonzero winding rule, e.g., glyphs in TrueType®fonts.

The merge contours procedure can also be used to eliminate interior edgehaloes and outlining artifacts present in various font renderingsystems. The even-odd parity rule is less complex and faster to performthan the nonzero winding rule. Consequently, the merge contoursprocedure can be used to convert the input path to an equivalent outputpath and then rendered using the even-odd parity rule.

The merge contours procedure can also be used to perform two-dimensionalconstructive solid geometry (CSG) operations, such as union,intersection, and difference, on two-dimensional paths.

The merge contours procedure solves a very difficult computationalgeometry problem in real-time and has several distinguishing featureswhen compared to the prior art. The merge contours procedure can handledifficult grazing conditions and singularities, e.g., coincident pointsand segments. The procedure supports nonlinear curved edges, as well asdirected edges. Most prior art procedures only work on polygons withlinear edges. The merge contours procedure can use integer arithmeticand operate on an integer grid. It is one to two orders of magnitudefaster than comparable prior art procedures.

The merge contours procedure also provides concurrent classification ofcoincident edges to properly handle grazing conditions, degeneratepreprocessing and post processing of segments and contours, andon-demand tessellation of curved segments for determining intersections.The tessellation of curved segments can be based on a target renderingsize, thereby optimizing performance for the given target. Monotonicityof segments can be enforced for better performance and accuracy. Duringthe merging, all control points can be represented on an integercoordinate system to improve accuracy and performance. When contoursegments are partitioned and split at intersections, the procedure canuse iterative intersection testing until convergence to ensurerobustness.

The correct labeling of segments as either interior or exterior permitspath rendering systems, path compression systems, path simplificationsystems, and the like to function correctly when the path containsdegenerate cases.

Although the invention has been described by way of examples ofpreferred embodiments, it is to be understood that various otheradaptations and modifications can be made within the spirit and scope ofthe invention. Therefore, it is the object of the appended claims tocover all such variations and modifications as come within the truespirit, and scope of the invention.

We claim:
 1. A method for labeling a segment of an input path as eitherinterior or exterior, wherein the input path is defined according to anonzero winding rule in a two-dimensional (2D) coordinate system, theinput path includes a set of contours, and wherein each contour includesa sequence of segments, comprising the steps of: initializing a windingnumber to zero; identifying a scan line that intersects the segment;accumulating, for each contour, winding values into the winding numberfor any segments of the contour that cross the scan line, wherein theaccumulation for coincident segments of the contour that cross the scanline at a same location as the segment is postponed until after all thecontours have been processed, and wherein the coincident segments aremarked, and wherein the marked coincident segments are saved in a list;labeling the segment as interior if the list is empty and the windingnumber is not zero and the winding number when updated to account forthe segment is not zero; labeling the segment as exterior if the list isempty and either the winding number is zero or the winding number whenupdated to account for the segment is zero; labeling the segment asinterior if the list is not empty and, after canceling out pairs ofsegments of the list that have opposite directions, the list isaugmented to contain the segment, and accumulating the winding valuesinto the winding number for any remaining non-cancelled segments in thelist excluding the segment, the winding number is not zero and thewinding number when updated to account for the segment is not zero; andlabeling the segment as exterior if the list is not empty and, aftercanceling out pairs of segments of the list that have oppositedirections, the list is augmented to contain the segment, andaccumulating the winding values into the winding number for theremaining non-cancelled segments in the list excluding the segment,either the winding number is zero or the winding number when updated toaccount for the segment is zero, wherein the steps are performed in aprocessor.
 2. The method of claim 1, wherein the input path represents aglyph.
 3. The method of claim 1, wherein the input path represents anillustration.
 4. The method of claim 1, wherein the input pathrepresents a structured vector graphic.
 5. The method of claim 1,further comprising: enforcing monotonicity on the segments andidentifying the scan line to be either a horizontal or vertical scanline passing through a midpoint of the segment.
 6. The method of claim1, wherein the degenerate segments include an segment with a start pointcoincident with an end point of the segment, any segment that is a curvewith the start point and the end point on an interior portion of thecurve, and any segment with an off-curve control point of the curve thatis coincident with either the start point or the end point of the curve,and wherein the degenerate contours include any contour that is anunbounded or an open region, or a region with a zero area, or anycontour defined by a single point.
 7. The method of claim 1, whereinsome of the segments are coincident.
 8. The method of claim 1, whereinsome of the contours are self-intersecting.
 9. The method of claim 1,wherein intersection points between the contours are determined prior tothe initializing.
 10. The method of claim 1, wherein the labeled segmentis used by a rendering system to rasterize the input path withoutartifacts.
 11. The method of claim 1, wherein the labeled segment isused by a rendering system to outline the input path without artifacts.12. The method of claim 1, wherein the labeled segment is used by a datacompression system to compress the input path.